retire LegacyFormat class. (#1233)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Sun, 19 Nov 2023 02:07:36 +0000 (19:07 -0700)
committerGitHub <noreply@github.com>
Sun, 19 Nov 2023 02:07:36 +0000 (19:07 -0700)
CMakeLists.txt
defs.h
deprecated/legacyformat.h [new file with mode: 0644]
legacyformat.h [deleted file]
vecs.cc

index d96f2d5c71af9750f62a74db545fca1476e3ba89..b02d70d55902074e0296cf9a8d81737bfaeef8b5 100644 (file)
@@ -227,7 +227,6 @@ set(HEADERS
   html.h
   inifile.h
   kml.h
-  legacyformat.h
   igc.h
   lowranceusr.h
   mkshort.h
diff --git a/defs.h b/defs.h
index 99e3a54bcd09072c24d10ef5e5cd126e129a6280..1e4523f43510fb139cef50b395b96c9ddfac935c 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -807,14 +807,6 @@ struct posn_status {
 
 extern posn_status tracking_status;
 
-using ff_init = void (*)(const QString&);
-using ff_deinit = void (*)();
-using ff_read = void (*)();
-using ff_write = void (*)();
-using ff_exit = void (*)();
-using ff_writeposn = void (*)(Waypoint*);
-using ff_readposn = Waypoint* (*)(posn_status*);
-
 #define ARGTYPE_UNKNOWN    0x00000000U
 #define ARGTYPE_INT        0x00000001U
 #define ARGTYPE_FLOAT      0x00000002U
@@ -886,38 +878,6 @@ enum ff_cap {
 #define FF_CAP_RW_WPT \
        { (ff_cap) (ff_cap_read | ff_cap_write), ff_cap_none, ff_cap_none}
 
-/*
- * Format capabilities for realtime positioning.
- */
-struct position_ops_t {
-  ff_init rd_init;
-  ff_readposn rd_position;
-  ff_deinit rd_deinit;
-
-  ff_init wr_init;
-  ff_writeposn wr_position;
-  ff_deinit wr_deinit;
-};
-
-#define NULL_POS_OPS { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }
-
-/*
- *  Describe the file format to the caller.
- */
-struct ff_vecs_t {
-  ff_type type;
-  QVector<ff_cap> cap;
-  ff_init rd_init;
-  ff_init wr_init;
-  ff_deinit rd_deinit;
-  ff_deinit wr_deinit;
-  ff_read read;
-  ff_write write;
-  ff_exit exit;
-  QVector<arglist_t>* args;
-  position_ops_t position_ops;
-};
-
 [[noreturn]] void fatal(QDebug& msginstance);
 // cppcheck 2.10.3 fails to assign noreturn attribute to fatal if
 // the noreturn attribute is listed before the gnu::format attribute.
diff --git a/deprecated/legacyformat.h b/deprecated/legacyformat.h
new file mode 100644 (file)
index 0000000..2ce9259
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+
+    Legacy format shim.
+
+    Copyright (C) 2019 Robert Lipe, robertlipe+source@gpsbabel.org
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+ */
+#ifndef LEGACYFORMAT_H_INCLUDED_
+#define LEGACYFORMAT_H_INCLUDED_
+
+#include "defs.h"
+#include "format.h"
+
+
+class LegacyFormat : public Format
+{
+public:
+  LegacyFormat() = default;
+  explicit LegacyFormat(const ff_vecs_t& v) : vec(v) {}
+
+  /*******************************************************************************
+  * %%%        global callbacks called by gpsbabel main process              %%% *
+  *******************************************************************************/
+
+  void rd_init(const QString& fname) override
+  {
+    if (vec.rd_init != nullptr) {
+      vec.rd_init(fname);
+    }
+  }
+
+  void rd_deinit() override
+  {
+    if (vec.rd_deinit != nullptr) {
+      vec.rd_deinit();
+    }
+  }
+
+  void read() override
+  {
+    if (vec.read != nullptr) {
+      vec.read();
+    }
+  }
+
+  void wr_init(const QString& fname) override
+  {
+    if (vec.wr_init != nullptr) {
+      vec.wr_init(fname);
+    }
+  }
+
+  void wr_deinit() override
+  {
+    if (vec.wr_deinit != nullptr) {
+      vec.wr_deinit();
+    }
+  }
+
+  void write() override
+  {
+    if (vec.write != nullptr) {
+      vec.write();
+    }
+  }
+
+  void exit() override
+  {
+    if (vec.exit != nullptr) {
+      vec.exit();
+    }
+  }
+
+  void rd_position_init(const QString& fname) override
+  {
+    if (vec.position_ops.rd_init != nullptr) {
+      vec.position_ops.rd_init(fname);
+    }
+  }
+
+  Waypoint* rd_position(posn_status* status) override
+  {
+    if (vec.position_ops.rd_position != nullptr) {
+      return vec.position_ops.rd_position(status);
+    }
+    return nullptr;
+  }
+
+  void rd_position_deinit() override
+  {
+    if (vec.position_ops.rd_deinit != nullptr) {
+      vec.position_ops.rd_deinit();
+    }
+  }
+
+  void wr_position_init(const QString& fname) override
+  {
+    if (vec.position_ops.wr_init != nullptr) {
+      vec.position_ops.wr_init(fname);
+    }
+  }
+
+  void wr_position(Waypoint* wpt) override
+  {
+    if (vec.position_ops.wr_position != nullptr) {
+      vec.position_ops.wr_position(wpt);
+    }
+  }
+
+  void wr_position_deinit() override
+  {
+    if (vec.position_ops.wr_deinit != nullptr) {
+      vec.position_ops.wr_deinit();
+    }
+  }
+
+  /*******************************************************************************
+  * %%%                          Accessors                                   %%% *
+  *******************************************************************************/
+
+  QVector<arglist_t>* get_args() override
+  {
+    return vec.args;
+  }
+
+  ff_type get_type() const override
+  {
+    return vec.type;
+  }
+
+  QVector<ff_cap> get_cap() const override
+  {
+    return vec.cap;
+  }
+
+private:
+  ff_vecs_t vec;
+
+};
+#endif // LEGACYFORMAT_H_INCLUDED_
diff --git a/legacyformat.h b/legacyformat.h
deleted file mode 100644 (file)
index 2ce9259..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-
-    Legacy format shim.
-
-    Copyright (C) 2019 Robert Lipe, robertlipe+source@gpsbabel.org
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
- */
-#ifndef LEGACYFORMAT_H_INCLUDED_
-#define LEGACYFORMAT_H_INCLUDED_
-
-#include "defs.h"
-#include "format.h"
-
-
-class LegacyFormat : public Format
-{
-public:
-  LegacyFormat() = default;
-  explicit LegacyFormat(const ff_vecs_t& v) : vec(v) {}
-
-  /*******************************************************************************
-  * %%%        global callbacks called by gpsbabel main process              %%% *
-  *******************************************************************************/
-
-  void rd_init(const QString& fname) override
-  {
-    if (vec.rd_init != nullptr) {
-      vec.rd_init(fname);
-    }
-  }
-
-  void rd_deinit() override
-  {
-    if (vec.rd_deinit != nullptr) {
-      vec.rd_deinit();
-    }
-  }
-
-  void read() override
-  {
-    if (vec.read != nullptr) {
-      vec.read();
-    }
-  }
-
-  void wr_init(const QString& fname) override
-  {
-    if (vec.wr_init != nullptr) {
-      vec.wr_init(fname);
-    }
-  }
-
-  void wr_deinit() override
-  {
-    if (vec.wr_deinit != nullptr) {
-      vec.wr_deinit();
-    }
-  }
-
-  void write() override
-  {
-    if (vec.write != nullptr) {
-      vec.write();
-    }
-  }
-
-  void exit() override
-  {
-    if (vec.exit != nullptr) {
-      vec.exit();
-    }
-  }
-
-  void rd_position_init(const QString& fname) override
-  {
-    if (vec.position_ops.rd_init != nullptr) {
-      vec.position_ops.rd_init(fname);
-    }
-  }
-
-  Waypoint* rd_position(posn_status* status) override
-  {
-    if (vec.position_ops.rd_position != nullptr) {
-      return vec.position_ops.rd_position(status);
-    }
-    return nullptr;
-  }
-
-  void rd_position_deinit() override
-  {
-    if (vec.position_ops.rd_deinit != nullptr) {
-      vec.position_ops.rd_deinit();
-    }
-  }
-
-  void wr_position_init(const QString& fname) override
-  {
-    if (vec.position_ops.wr_init != nullptr) {
-      vec.position_ops.wr_init(fname);
-    }
-  }
-
-  void wr_position(Waypoint* wpt) override
-  {
-    if (vec.position_ops.wr_position != nullptr) {
-      vec.position_ops.wr_position(wpt);
-    }
-  }
-
-  void wr_position_deinit() override
-  {
-    if (vec.position_ops.wr_deinit != nullptr) {
-      vec.position_ops.wr_deinit();
-    }
-  }
-
-  /*******************************************************************************
-  * %%%                          Accessors                                   %%% *
-  *******************************************************************************/
-
-  QVector<arglist_t>* get_args() override
-  {
-    return vec.args;
-  }
-
-  ff_type get_type() const override
-  {
-    return vec.type;
-  }
-
-  QVector<ff_cap> get_cap() const override
-  {
-    return vec.cap;
-  }
-
-private:
-  ff_vecs_t vec;
-
-};
-#endif // LEGACYFORMAT_H_INCLUDED_
diff --git a/vecs.cc b/vecs.cc
index 4d8826d03aab1f64221defa44e4cce96d16c8da6..42c1f4291cc53fe885d6e6fca9f037a91790f836 100644 (file)
--- a/vecs.cc
+++ b/vecs.cc
@@ -61,7 +61,6 @@
 #include "igc.h"               // for IgcFormat
 #include "inifile.h"           // for inifile_readstr
 #include "kml.h"               // for KmlFormat
-#include "legacyformat.h"      // for LegacyFormat
 #include "lowranceusr.h"       // for LowranceusrFormat
 #include "mtk_logger.h"        // for MtkFormat, MtkM241Format, MtkFileFormat, MtkM241FileFormat
 #include "nmea.h"              // for NmeaFormat